package com.shop.cereshop.commons.enums.rank;

/**
 * @description: 排名类型枚举类
 * @author lx
 * @date 2025/10/18 17:54
 * @version 1.0
 */
public enum RankTypeEnum {
    //商家数量榜单
    SHOP_NUM(1, "商家数量榜单"),
    //商家成交额榜单
    SHOP_AMOUNT(2, "商家成交额榜单"),
    //用户数量榜单
    USER_NUM(3, "用户数量榜单"),
    //用户成交额榜单
    USER_AMOUNT(4, "用户成交额榜单"),
    //业务员数量榜单
    SALESPERSION_NUM(5, "业务员数量榜单"),
    //代理商数量榜单
    AGENT_NUM(6, "代理商数量榜单");

    private Integer code;
    private String msg;

    private RankTypeEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }

    public static String getMsgByCode(Integer code) {
        for (RankTypeEnum value : RankTypeEnum.values()) {
            if (value.getCode().equals(code)) {
                return value.getMsg();
            }
        }
        return null;
    }

    public static Integer getCodeByMsg(String msg) {
        for (RankTypeEnum value : RankTypeEnum.values()) {
            if (value.getMsg().equals(msg)) {
                return value.getCode();
            }
        }
        return null;
    }
}
